<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<jsp:include page="/product/include/base_product_pre_part.jsp"></jsp:include>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/product.css" />

<s:if test="product==null ">
	<s:text name="product.not.exist"></s:text>
</s:if>
<s:else>
	<form action="<%=request.getContextPath()%>/product/saveProduct.do" method="post">
		<table width="%100">
			<s:hidden name="product.id" />
			<s:label name="product.category.chainName" label="%{getText('category')}" />
			<s:label name="product.name" label="%{getText('name')}" />
			<tr>
				<td class="tdLabel">
					<s:text name="introduction"></s:text>:
				</td>
				<td>
					<s:property value="toHtml(product.introduction)" escape="false" />
				</td>
			</tr>
			<tr>
				<td class="tdLabel">
					商品/服务参数:
				</td>
				<td>
					<ul id="properties">
						<s:iterator value="product.properties">
							<li>
								<label class="property">
									<s:property value="name" />
								</label>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<span style="background: #f6f6f6;"> <s:iterator value="values">
										<s:property value="value" />&nbsp;&nbsp;
									</s:iterator> </span>
							</li>
						</s:iterator>
						<script type="text/javascript">
						$(document).ready(function(){
							var properties = $("#properties").find("li");
							$.each(properties,function(){
								var li = $(this);
								var label = li.find("label").css("cursor", "pointer");
								var span = li.find("span").css("cursor", "pointer");
								//label.mouseover(function () {span.show(); });
								//span.mouseout(function () {span.hide(); });
							});
						});
						</script>
					</ul>
					<s:if test="canEditProduct()">
						<a href="<%=request.getContextPath()%>/product/editProperties.do?id=<s:property value="product.id"/>"> 编辑商品/服务参数 </a>
					</s:if>
				</td>
			</tr>
			<tr>
				<td></td>
				<td></td>
			</tr>
		</table>
	</form>

	<s:if test="canEditProduct()">
		<div>
			<a href="<%=request.getContextPath()%>/product/editProduct.do?id=<s:property value="product.id"/>"> 编辑 </a>
		</div>
	</s:if>
	<s:if test="product.canCreateOrder()">
		<div>
			<a href="<%=request.getContextPath()%>/order/createOrder.do?categoryId=<s:property value="product.category.id"/>" target="_blank"> 创建订单 </a>
		</div>
	</s:if>
	<div>
		<s:if test="orders==null || orders.size()==0">此商品/服务还没有相关订单!</s:if>
		<s:else> 此商品/服务的相关订单：<ul>
				<s:iterator value="orders">
					<li>
						<a href="<%=request.getContextPath()%>/order/viewOrder.do?id=<s:property value="id"/>" target="_blank"><s:property value="title" /> </a>
					</li>
				</s:iterator>
			</ul>
		</s:else>
	</div>
</s:else>
<jsp:include page="/product/include/base_product_last_part.jsp"></jsp:include>